#include<bits/stdc++.h>
#define sd(n) scanf("%d",&n) 
#define sld(n) scanf("%lld",&n)
#define pd(n) printf("%d", (n))
#define pld(n) printf("%lld", n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fi first
#define se second
const int N=2e5;
#define INF 0x7fffffff
typedef long long int ll;
using namespace std;
//----------------------------------------------------------------------------//
int minMaxGame(vector<int>& nums)
    {
        vector<int> v(nums);
        while (v.size()>1)
        {
            vector<int> v2;
            bool ok = true;
            for (int i = 0; i < v.size(); i += 2)
            {
                if (!ok)
                {
                    int t = max(v[i], v[i + 1]);
                    v2.push_back(t);
                    ok = true;
                    continue;
                }

                if (ok)
                {
                    int t = min(v[i], v[i + 1]);
                    v2.push_back(t);
                    ok = false;
                    continue;
                }
            }
            // if (v2.size() == 1) return v2[0];
            // else v = v2;
            v=v2;
        }
        return v[0];

    }